package com.internship.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.internship.dao.NewsDao;
import com.internship.model.News;
import com.internship.page.Page;

@Service
public class NewsService {
	private final int PAGE_SIZE = 10;
	@Autowired
	private NewsDao newsDao;

	public News getNewsById(int Id) {
		return newsDao.getNewsById(Id);
	}
	public Page<News> getNewsList(String DeptCode,String Title,int pageNumber) {
		Page<News> page = new Page<News>(pageNumber, PAGE_SIZE);
		List<News> list = newsDao.getNewsList(DeptCode, Title, page);
		page.setResultList(list);
		return page;
	}
	public int addNews(News news) {
		return newsDao.addNews(news);
	}
	public int updateNews(News news) {
		return newsDao.updateNews(news);
	}
	public int delNews(int Id) {
		return newsDao.delNews(Id);
	}
	public int delAll(String[] ids) {
		return newsDao.delAll(ids);
	}

}
